package com.em;


import be.ac.ulg.montefiore.run.distributions.GaussianDistribution;
import be.ac.ulg.montefiore.run.jahmm.Observation;
import be.ac.ulg.montefiore.run.jahmm.apps.cli.CommandLineArguments;
import be.ac.ulg.montefiore.run.jahmm.apps.cli.Types;
import be.ac.ulg.montefiore.run.jahmm.apps.cli.WrongArgumentsException;
import be.ac.ulg.montefiore.run.jahmm.io.FileFormatException;
import com.qp.ContionousOutputDistributionEstimator;
import com.qp.OutputDistributionCalculator;
import com.utils.SequenceIterator;

import java.io.*;
import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: bigmar
 * Date: 12/3/14
 * Time: 9:00 PM
 * To change this template use File | Settings | File Templates.
 */
public class Main
{
    public static void main(String[] args) throws IOException, WrongArgumentsException, FileFormatException
    {

        System.out.println(new Date());
        InputStream seqStream = new FileInputStream("C:\\workspace\\jahmm-0.6.1\\trivial.seq");
        Reader seqReader = new InputStreamReader(seqStream);
        CommandLineArguments.Arguments.OPDF.set("gaussian");
        CommandLineArguments.Arguments.OPDF.setIsSet(true);
        List<? extends List<? extends Observation>> seqs = Types.relatedObjs().readSequences(seqReader);


        int numberOfModels=4;
        int numberOfObservations=10000;
        SequenceIterator sequenceIterator=new SequenceIterator(seqs, numberOfObservations);
        EmForGaussiansResult emForGaussiansResult=new EMForGaussians(numberOfModels, numberOfObservations, sequenceIterator).run();
        for (int k=0; k<numberOfModels; ++k)
            System.out.println(emForGaussiansResult.getGaussianList().get(k));
        for (int k=0; k<numberOfModels; ++k)
            System.out.println(emForGaussiansResult.getMixtureWeights()[k]);
        System.out.println(new Date());



    }


}
